package com.jiawa.train.business.controller.admin;

import com.jiawa.train.common.resp.PageResult;
import com.jiawa.train.common.resp.Result;
import com.jiawa.train.business.req.DailyTrainStationQueryReq;
import com.jiawa.train.business.req.DailyTrainStationSaveReq;
import com.jiawa.train.business.service.DailyTrainStationService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/dailyTrainStation")
@Slf4j
public class DailyTrainStationAdminController {

    @Resource
    private DailyTrainStationService dailyTrainStationService;
    @PostMapping("/save")
    public Result save(@RequestBody @Valid DailyTrainStationSaveReq req) {
        dailyTrainStationService.save(req);
        return Result.success();
    }
    @GetMapping("/page")
    public Result<PageResult> queryDailyTrainStationList(DailyTrainStationQueryReq  req) {
       PageResult pageResult = dailyTrainStationService.queryDailyTrainStationList(req);
       return Result.success(pageResult);
    }
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        dailyTrainStationService.delete(id);
        return Result.success();
    }
}

